package com.atxwq.shop.user.controller;

import com.atxwq.shop.model.entity.user.UserAddress;
import com.atxwq.shop.model.vo.common.Result;
import com.atxwq.shop.model.vo.common.ResultCodeEnum;
import com.atxwq.shop.user.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description TODO
 * @Date 2025/5/23 10:52
 * @Created by 12336
 */

@RestController
@RequestMapping("api/user/userAddress")
public class UserAddressController {

    @Autowired
    private UserAddressService userAddressService;

    /**
     * 查询用户地址列表
     * @return
     */
    @GetMapping("auth/findUserAddressList")
    public Result findUserAddressList(){
        List<UserAddress> list = userAddressService.findUserAddressList();
        return Result.build(list, ResultCodeEnum.SUCCESS);

    }


    //远程调用
    @GetMapping("getUserAddress/{id}")
    public UserAddress getUserAddress(@PathVariable Long id){
       return userAddressService.getById(id);
    }
}
